using System;
using UnityEngine;
namespace DefaultNamespace
{
    public class TestOverlapBox : MonoBehaviour
    {
        [Header("检测盒子的Vector3")]
        public Vector3 ColliderV3;
    
        void Update()
        {
            //模拟的盒子中心点，x、y、z轴长度的一半
            Collider[] collider = Physics.OverlapBox(gameObject.transform.position, ColliderV3/2, Quaternion.identity,LayerMask.GetMask("Enemy"));

            foreach (var col in collider)
            {
                Debug.Log("检测到的游戏对象："+col);
            }
        }

        private void OnDrawGizmos()
        {
            Gizmos.color = Color.green;//改变线框的颜色
            Gizmos.DrawWireCube(transform.position, ColliderV3);//正方体虚线框
        }
    }
}